package jee.boot.encrypt.config;

import jee.boot.encrypt.aes.AesImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置加密策略
 */
@Configuration
public class EncryptConfig {
    /**
     * 默认使用AES进行加解密
     * @return
     */
    @Bean
    @ConditionalOnMissingBean(IEncryptDecrypt.class)
    public IEncryptDecrypt encryptDecrypt(@Autowired DataEncryptConfig config) {
        return new AesImpl(config);
    }
}
